/*
 *
 *  * Copyright (c) 2016. For Intelligent Group.
 *
 */

package com.intelligent.ispc.r.service;

import com.intelligent.ispc.core.dto.*;
import com.intelligent.ispc.r.dto.AnalysisParamDto;
import com.intelligent.ispc.r.dto.ControlDataDto;
import com.intelligent.ispc.r.dto.NormalDistributionDto;
import com.intelligent.ispc.r.dto.ScatterDto;

import java.util.List;
import java.util.Map;

/**
 * Created by Peter.Li on 2015/10/28.
 */
public interface AnalysisService {

    /**
     * Analyse for the Normal Distribution.
     *
     * @param analysisParamDto the params of analysis
     * @param cpWarningRules the warning rules
     * @return the data dto
     */
    NormalDistributionDto analyseNormalDistribution(AnalysisParamDto analysisParamDto, List<CPWarningRuleDto> cpWarningRules);

    /**
     * Analyse for the Control Run Chart.
     *
     * @param type chart type, etc. Run, X-Bar...
     * @param analysisParamDto the params of analysis
     * @param ruleList the config of spc
     * @return the data dto
     */
    ControlDataDto analyseControlChart(String type, AnalysisParamDto analysisParamDto, List<SpcConfigDto> ruleList);

    /**
     * Analyse the GRR for more test items.
     * @param grrParamDto the param of chart data
     * @param grrAnalysisDataDtos the data of analysis
     * @return the data dto list
     */
    List<GrrSummaryDto> analyseGrrSummary(GrrParamDto grrParamDto, List<GrrAnalysisDataDto> grrAnalysisDataDtos);

    /**
     * Analyse the GRR for anava and source data.
     * @param grrParamDto the param of chart data
     * @param grrAnalysisDataDto the data of analysis
     * @return the data dto map
     */
    Map<String, Object> analyseGrrAnovaAndSource(GrrParamDto grrParamDto, GrrAnalysisDataDto grrAnalysisDataDto);

    /**
     * Analyse the GRR Chart data.
     * @param grrParamDto the param of chart data
     * @param grrAnalysisDataDto the data of analysis
     * @return the data dto
     */
    GrrChartDto analyseGrrChartData(GrrParamDto grrParamDto, GrrAnalysisDataDto grrAnalysisDataDto);

    /**
     * Analyse the GRR Chart image.
     * @param grrParamDto the param of chart imge
     * @param grrAnalysisDataDto the data of analysis
     */
    void analyseGrrChartPlot(GrrParamDto grrParamDto, GrrAnalysisDataDto grrAnalysisDataDto);

    /**
     * Analyse for the Scatter.
     *
     * @param analysisParamDto the params of analysis
     * @param cpWarningRules the warning rules
     * @return the data dto
     */
    ScatterDto analyseScatter(AnalysisParamDto analysisParamDto, List<CPWarningRuleDto> cpWarningRules);
}
